
const PublicModel = require("@/common/public.model");
const { TenantContext } = require("@/core/tenant-context");


/**
 * 库存模型
 * @create_by Haor
 * @create_at 2025/07/24 16:38:36
 */
class InventoryModel extends PublicModel {
    /**
     * 创建库存
     */
    createInventory(data) {
       return this.create(data);
    }

    /**
     * 删除库存
     */
    deleteInventory(id) {
       return this.deleteById({ table: '', id });
    }

    /**
     * 修改库存
     */
    updateInventory({ id, data, result }) {
        return this.updateById({ table: '', data: data, id: id, result: result })
    }

    /**
     * 查询库存列表
     */
    queryInventoryList({ page, page_size, ...data}) {
       const SQL = `
       SELECT
            * 
        FROM 
            table_name 
        WHERE 
            tenant_id = '${TenantContext.getCurrentTenant()}'  
            AND is_delete = 0 
        LIMIT ${this.pageLimit(page_size, page)} 
       `
       return this.query(SQL);
    }

    /**
     * 查询库存
     */
    getInventoryItem(id) {
       return this.findById({ table: '', id: id });
    }
    
     /**
     * 获取库存总条数
     */
    getInventoryTotal({ data }) {
        
    }
}

module.exports = new InventoryModel();

            